<?php
// 排序
$arr_orderby    = array(
    "id"            => '&orderby=id',
    'aid'           => '&orderby=aid',
    'cid'           => '&orderby=cid',
    'article_title' => '&orderby=article_title',
    'add_time'      => '&orderby=add_time',
    'display'         => '&orderby=display',
    );
$orderby    = strtolower(trim(@$_GET['orderby']));
if(array_key_exists($orderby, $arr_orderby)) {
    $order_asc  = @(int)$_GET['desc'];
    $arr_orderby[$orderby] .= $order_asc == 0 ? '&desc=1' : '&desc=0';
} else {
    $arr_orderby['aid'] .= '&desc=0';
}

// 保存数据框架名
$save_frame = $_SESSION[$G_admin_session_key]['save_frame'];
$back_url   = get_current_url();
// 将当前URL保存在Cookie中，避免复杂的URL字符串
cookie('back_url', strcode($back_url));
$url_cur    = get_current_url(array('orderby', 'desc'));


/**
 * 搜索参数处理
 *
 */
// 关键字
$key            = trim(@$_GET['key']);
// 是否包含子类
$class_id       = @(int)$_GET['class_id'];
$class_all      = @(int)$_GET['class_all'];
$chk_class_all  = ($class_all==1) ? ' checked' : '';
// 是否显示
$display        = @(int)$_GET['display'];
$chk_display_all= '';
$chk_display_2  = '';
$chk_display_1  = '';
if($display == 2) {
    $chk_display_2  = ' checked';
} elseif($display == 1) {
    $chk_display_1  = ' checked';
} else {
    $chk_display_all= ' checked';
}


$begin_date = @$_GET['begin_date'];
$end_date   = @$_GET['end_date'];
$is_ad      = @(int)$_GET['is_ad'];

$dsp_ad     = ($is_ad == 1) ? 'style="display:block"':'style="display:none"';



$chk_haveimg    = @(int)$_GET['haveimg'] == 1 ? ' checked':'';
$chk_top        = @(int)$_GET['top'] == 1 ? ' checked':'';
$chk_new        = @(int)$_GET['new'] == 1 ? ' checked':'';
$chk_recommend  = @(int)$_GET['recommend'] == 1 ? ' checked':'';
$tbl_mem    = $_TABLES['members'];
$conn   = & get_db_conn();
require($abs_admin_cppath . '/header.php');
?>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['static'] ?>/js/popcalendar.js"></SCRIPT>
<div class="datacontainer1" id="listDiv">
<form action="<?php echo $mod_url['m.del'] ?>" name="items_form" method="post" target="<?php echo $save_frame?>" onsubmit="return submit_select_items(this.name, 'item_id[]');">
    <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" width="100%" class="list_table">
<THEAD>
	<TR class="list_head">
		<TH scope=col width="20" class="text_align_center"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['id'] ?>">#</a></TH>
        <TH scope=col width="100"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['aid'] ?>">所属分类</a></TH>
		<TH scope=col><a href="<?php echo $url_cur ?><?php echo $arr_orderby['aid'] ?>">资产名称</a></TH>
		<TH scope=col width="100">姓名</TH>
        <?php if($cata==1){?>
        <TH scope=col width="100">金额</TH>
        <?php }?>
		<TH scope=col width="100"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['add_time'] ?>">发布时间</a></TH>
		<TH scope=col width="80">操作</TH></TR></THEAD>
<TBODY>
<?php
$tr_class   = '';
if(!empty($record) && sizeof($record) > 0) {
    foreach($record as $k=>$v) {
        $tr_class   = $tr_class != 'tr0' ? 'tr0' : 'tr1';
        $id = $v['id'];

        $article_title      = $v['article_title'];
        $article_title_cut  = zh_substr($article_title, 40);
        $txt_posttime       = date(DATE_FORMAT, $v['add_time']);
        $cinfo              = get_node_info($$class_var, $v['cid']);
        $cname              = $cinfo['cname'];
        //$nickname           = htmlspecialchars($v['nickname']);
        $sql="select * from $tbl_mem where uid={$v['uid']}";
        $view_var   = $conn->GetRow($sql);
        $nickname=$view_var['username'];

?>
	<TR class="<?php echo $tr_class ?>" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);">
		<TD width="20" class="text_align_center"><input type="checkbox" value="<?php echo $v['id']; ?>" name="item_id[]"></TD>
		<TD width="100" class="text_align_center">&nbsp;<?php echo $cname; ?></TD>
		<TD title="<?php echo $article_title; ?>">&nbsp;<?php echo $article_title_cut; ?></TD>
		<TD width="100" align="center">&nbsp;<?php echo $nickname; ?></TD>
        <?php if($cata==1){?>
        <TD width="100" align="center">&nbsp;<?php echo $v['money']; ?></TD>
        <?php }?>
		<TD width="100" class="time01" align="center"><?php echo $txt_posttime; ?></TD>
		<TD width="80">
			<a href="<?php echo $G_web_root.'/admin/admin.php?mod=pro&cata=1&action=m.modify';//$mod_url['m.modify'] ?>&id=<?php echo $v['id']; ?>" class="btn_comment fl" title="查看报价详情">查看报价详情</a>
            <a href="<?php echo $mod_url['modify'] ?>&aid=<?php echo $v['aid']; ?>" class="btn_modify fl" title="查看项目">查看项目</a> 
			<a href="<?php echo $mod_url['m.del'] ?>&item_id=<?php echo $v['id']; ?>" target="<?php echo $save_frame; ?>" onclick="return del_this();"class="btn_del fl" title="删除<?php if($cata==1){echo '出价';}else{echo '购买';}?>内容">删除</a>
		</TD></TR>
<?php
}
} else {
?>
<TR class="tr0" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);">
<TD colspan="7">没有或没有找到合适的记录！</td>
</td>
<?php
}
?>
</TBODY>
</TABLE>
    
<?php
// 分页
$page_info  = "共 $record_total 条记录 每页 $page_size 条 共 $page_total 页 ";
$page_list  = get_page_nav($url_global['admin_cp'], $page_total, 'page_list_tpl');
?>

<div class="page_nav">
	<div class="page_info">
		<?php echo $page_info ?>
	</div>
	<div class="page_list_pre">
		&nbsp;&nbsp;<a href="javascript:void(0);" onclick="chkbox_sel_all('items_form', 'item_id[]');"><B>全选</B></a> <a href="javascript:void(0);" onclick="chkbox_sel_reverse('items_form', 'item_id[]');"><B>反选</B></a>
	</div>
	<div class="page_list">
		<?php echo $page_list?>
	</div>
</div>

<div class="new_line">
<input type="submit" name="del" value="删除" class="btn fl">
<input type="hidden" name="deltype" value="1">

</div>
</form>
		</div>
</div>
<?php
require($abs_admin_cppath . '/footer.php');
?>